package com.cc.controller;

import com.cc.dao.StudentDao;
import com.cc.pojo.Student;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by cc on 2017/6/7.
 */

public class StudentListController extends javax.servlet.http.HttpServlet {
    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        List<Student> list = new ArrayList<Student>();
        StudentDao dao = new StudentDao();
        list = dao.list();
        request.setAttribute("list", list);
        request.getRequestDispatcher("studentList.jsp")
                .forward(request, response);
    }
}
